/**
 * 权限适配函数,针对小程序中不能使用指令的问题
 */
import store from '../store/index.js'
export default (type, pers = []) => {
	switch (type) {
		case 'or':
			if (pers && pers.length > 0) {
				for (let i = 0, len = pers.length; i < len; i++) {
					if (store.getters.getAuth.includes(pers[i])) {
						return true;
					}
				}
				return false
			}
			return false
		case 'and':
			if (pers && pers.length > 0) {
				for (let i = 0, len = pers.length; i < len; i++) {
					if (!store.getters.getAuth.includes(pers[i])) {
						return false;
					}
				}
				return true
			}
			return false
		default:
			return false;
	}

	return false;
}
